// 引入地址、端口、一级路由
import {
  address,
  pathApi
} from "@/api/path";
// 引入 axios
import axios from "axios";
// 查询订单
const queryOrders = (condition, callback) => {
  axios({
    data: {
      startTime: condition.startTime,
      endTime: condition.endTime,
      idclerk: condition.idclerk,
      DsName: condition.DsName,
      code: condition.code,
      page: condition.page,
      limit: condition.limit,
      state: condition.state,
      appBs: condition.appBs,
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/SASaleOrder/findSASaleOrder`
  }).then(function (res) {
    callback(res.data)
  });
}
// 查询订单明细
const queryOrderDetial = (condition, callback) => {
  axios({
    data: {
      id: condition.id,
      DsName: condition.DsName,
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/SASaleOrder/findSaleOrderb`
  }).then(function (res) {
    callback(res.data)
  });
}
// 删除订单
const delOrder = (condition, callback) => {
  axios({
    data: {
      id: condition.id,
      DsName: condition.DsName,
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/SASaleOrder/deleteSaleOrder`
  }).then(function (res) {
    callback(res.data)
  });
}
// 修改订单
const updateOrder = (condition, callback) => {
  axios({
    data: condition,
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/SASaleOrder/set`
  }).then(function (res) {
    callback(res.data)
  });
}
export {
  queryOrders,
  delOrder,
  queryOrderDetial,
  updateOrder,
}
